//
//  UIButton+Category.swift
//  firstSwiftWeiBo
//
//  Created by Inverno on 16/12/5.
//  Copyright © 2016年 Inverno. All rights reserved.
//

import UIKit

extension UIButton {
    
    // 便利构造函数
    // 1:一般写在extension里
    // 2:前面需要有convenience(便利)
    // 3:必须要调用self.init()
    // 4:构造函数都不需要返回值
    convenience init(imageName : String ,imageNameH : String , backgroundImageName : String , backgroundImageNameH : String) {
        self.init()
        setImage(UIImage(named: imageName), forState: .Normal)
        setImage(UIImage(named: imageNameH), forState: .Normal)
        setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
        setBackgroundImage(UIImage(named: backgroundImageNameH), forState: .Highlighted)
        sizeToFit()
    }
    
}